package com.lm.activiti.boot.datatype;

import com.google.common.collect.Queues;
import lombok.SneakyThrows;

import java.util.Queue;

/**
 * @author lm_jcf
 * @date 2021/4/12 15:15
 */
public class QueueCase {

    public static void main(String[] args) throws InterruptedException {

        Queue<Integer> queue = Queues.newLinkedBlockingQueue();

        new Thread(new Runnable() {
            @SneakyThrows
            @Override
            public void run() {
                for (int i = 0; i < 100; i++) {
                    queue.offer(i);
                    Thread.sleep(500);
                }
            }
        }).start();

        Thread.sleep(5000);

        System.out.println(queue.size());

        for (Integer i : queue) {
        }

    }
}
